<!DOCTYPE html>
<html lang="en" dir="ltr" class="client-nojs">
<head>
<title>std::regex_constants::error_type - cppreference.com</title>
<meta charset="UTF-8">
<meta name="generator" content="MediaWiki 1.21.2">
<link rel="shortcut icon" href="../../../common/favicon.ico">
<link rel="stylesheet" href="../../../common/ext.css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" href="../../../common/site_modules.css">
<style>a:lang(ar),a:lang(ckb),a:lang(fa),a:lang(kk-arab),a:lang(mzn),a:lang(ps),a:lang(ur){text-decoration:none}#toc{display:none}.editsection{display:none}
/* cache key: mwiki1-mwiki_en_:resourceloader:filter:minify-css:7:472787eddcf4605d11de8c7ef047234f */</style>

<script src="../../../common/startup_scripts.js"></script>
<script>if(window.mw){
mw.config.set({"wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"cpp/regex/error_type","wgTitle":"cpp/regex/error type","wgCurRevisionId":137060,"wgArticleId":2322,"wgIsArticle":true,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":[],"wgBreakFrames":false,"wgPageContentLanguage":"en","wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgMonthNamesShort":["","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"wgRelevantPageName":"cpp/regex/error_type","wgRestrictionEdit":[],"wgRestrictionMove":[]});
}</script><script>if(window.mw){
mw.loader.implement("user.options",function(){mw.user.options.set({"ccmeonemails":0,"cols":80,"date":"default","diffonly":0,"disablemail":0,"disablesuggest":0,"editfont":"default","editondblclick":0,"editsection":0,"editsectiononrightclick":0,"enotifminoredits":0,"enotifrevealaddr":0,"enotifusertalkpages":1,"enotifwatchlistpages":0,"extendwatchlist":0,"externaldiff":0,"externaleditor":0,"fancysig":0,"forceeditsummary":0,"gender":"unknown","hideminor":0,"hidepatrolled":0,"imagesize":2,"justify":0,"math":1,"minordefault":0,"newpageshidepatrolled":0,"nocache":0,"noconvertlink":0,"norollbackdiff":0,"numberheadings":0,"previewonfirst":0,"previewontop":1,"quickbar":5,"rcdays":7,"rclimit":50,"rememberpassword":0,"rows":25,"searchlimit":20,"showhiddencats":0,"showjumplinks":1,"shownumberswatching":1,"showtoc":0,"showtoolbar":1,"skin":"cppreference2","stubthreshold":0,"thumbsize":2,"underline":2,"uselivepreview":0,"usenewrc":0,"watchcreations":0,"watchdefault":0,"watchdeletion":0,
"watchlistdays":3,"watchlisthideanons":0,"watchlisthidebots":0,"watchlisthideliu":0,"watchlisthideminor":0,"watchlisthideown":0,"watchlisthidepatrolled":0,"watchmoves":0,"wllimit":250,"variant":"en","language":"en","searchNs0":true,"searchNs1":false,"searchNs2":false,"searchNs3":false,"searchNs4":false,"searchNs5":false,"searchNs6":false,"searchNs7":false,"searchNs8":false,"searchNs9":false,"searchNs10":false,"searchNs11":false,"searchNs12":false,"searchNs13":false,"searchNs14":false,"searchNs15":false,"gadget-ColiruCompiler":1,"gadget-MathJax":1});;},{},{});mw.loader.implement("user.tokens",function(){mw.user.tokens.set({"editToken":"+\\","patrolToken":false,"watchToken":false});;},{},{});
/* cache key: mwiki1-mwiki_en_:resourceloader:filter:minify-js:7:9f05c6caceb9bb1a482b6cebd4c5a330 */
}</script>
<script>if(window.mw){
mw.loader.load(["mediawiki.page.startup","mediawiki.legacy.wikibits","mediawiki.legacy.ajax"]);
}</script>
<style type="text/css">/*<![CDATA[*/
.source-cpp {line-height: normal;}
.source-cpp li, .source-cpp pre {
	line-height: normal; border: 0px none white;
}
/**
 * GeSHi Dynamically Generated Stylesheet
 * --------------------------------------
 * Dynamically generated stylesheet for cpp
 * CSS class: source-cpp, CSS id: 
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 * --------------------------------------
 */
.cpp.source-cpp .de1, .cpp.source-cpp .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;}
.cpp.source-cpp  {font-family:monospace;}
.cpp.source-cpp .imp {font-weight: bold; color: red;}
.cpp.source-cpp li, .cpp.source-cpp .li1 {font-weight: normal; vertical-align:top;}
.cpp.source-cpp .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}
.cpp.source-cpp .li2 {font-weight: bold; vertical-align:top;}
.cpp.source-cpp .kw1 {color: #0000dd;}
.cpp.source-cpp .kw2 {color: #0000ff;}
.cpp.source-cpp .kw3 {color: #0000dd;}
.cpp.source-cpp .kw4 {color: #0000ff;}
.cpp.source-cpp .co1 {color: #909090;}
.cpp.source-cpp .co2 {color: #339900;}
.cpp.source-cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp.source-cpp .es0 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es1 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es2 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es3 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es4 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es5 {color: #008000; font-weight: bold;}
.cpp.source-cpp .br0 {color: #008000;}
.cpp.source-cpp .sy0 {color: #008000;}
.cpp.source-cpp .sy1 {color: #000080;}
.cpp.source-cpp .sy2 {color: #000040;}
.cpp.source-cpp .sy3 {color: #000040;}
.cpp.source-cpp .sy4 {color: #008080;}
.cpp.source-cpp .st0 {color: #008000;}
.cpp.source-cpp .nu0 {color: #000080;}
.cpp.source-cpp .nu6 {color: #000080;}
.cpp.source-cpp .nu8 {color: #000080;}
.cpp.source-cpp .nu12 {color: #000080;}
.cpp.source-cpp .nu16 {color:#000080;}
.cpp.source-cpp .nu17 {color:#000080;}
.cpp.source-cpp .nu18 {color:#000080;}
.cpp.source-cpp .nu19 {color:#000080;}
.cpp.source-cpp .ln-xtra, .cpp.source-cpp li.ln-xtra, .cpp.source-cpp div.ln-xtra {background-color: #ffc;}
.cpp.source-cpp span.xtra { display:block; }

/*]]>*/
</style><style type="text/css">/*<![CDATA[*/
.source-text {line-height: normal;}
.source-text li, .source-text pre {
	line-height: normal; border: 0px none white;
}
/**
 * GeSHi Dynamically Generated Stylesheet
 * --------------------------------------
 * Dynamically generated stylesheet for text
 * CSS class: source-text, CSS id: 
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 * --------------------------------------
 */
.text.source-text .de1, .text.source-text .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;}
.text.source-text  {font-family:monospace;}
.text.source-text .imp {font-weight: bold; color: red;}
.text.source-text li, .text.source-text .li1 {font-weight: normal; vertical-align:top;}
.text.source-text .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}
.text.source-text .li2 {font-weight: bold; vertical-align:top;}
.text.source-text .ln-xtra, .text.source-text li.ln-xtra, .text.source-text div.ln-xtra {background-color: #ffc;}
.text.source-text span.xtra { display:block; }

/*]]>*/
</style><!--[if lt IE 7]><style type="text/css">body{behavior:url("/mwiki/skins/cppreference2/csshover.min.htc")}</style><![endif]--></head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-cpp_regex_error_type skin-cppreference2 action-view cpp-navbar">
        <!-- header -->
        <!-- /header -->
        <!-- content -->
<div id="cpp-content-base">
            <div id="content">
                <a id="top"></a>
                <div id="mw-js-message" style="display:none;"></div>
                                <!-- firstHeading -->
<h1 id="firstHeading" class="firstHeading"><span style="font-size:0.7em; line-height:130%">std::regex_constants::</span>error_type</h1>
                <!-- /firstHeading -->
                <!-- bodyContent -->
                <div id="bodyContent">
                                        <!-- tagline -->
                    <div id="siteSub">From cppreference.com</div>
                    <!-- /tagline -->
                                        <!-- subtitle -->
                    <div id="contentSub"><span class="subpages">&lt; <a href="../../cpp.html" title="cpp">cpp</a>‎ | <a href="../regex.html" title="cpp/regex">regex</a></span></div>
                    <!-- /subtitle -->
                                                            <!-- bodycontent -->
                    <div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr"><div class="t-navbar" style=""><div class="t-navbar-sep"> </div><div class="t-navbar-head"><a href="../../cpp.html" title="cpp"> C++</a><div class="t-navbar-menu"><div><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em;">
<tr class="t-nv"><td colspan="5"> <a href="../compiler_support.html" title="cpp/compiler support"> Compiler support</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../freestanding.html" title="cpp/freestanding"> Freestanding and hosted</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../language.html" title="cpp/language"> Language</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../header.html" title="cpp/header"> Standard library headers</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../named_req.html" title="cpp/named req"> Named requirements </a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../feature_test.html" title="cpp/feature test"> Feature test macros </a> <span class="t-mark-rev t-since-cxx20">(C++20)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../utility.html#Language_support" title="cpp/utility"> Language support library</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../concepts.html" title="cpp/concepts"> Concepts library</a> <span class="t-mark-rev t-since-cxx20">(C++20)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../meta.html" title="cpp/meta"> Metaprogramming library</a> <span class="t-mark-rev t-since-cxx11">(C++11)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../error.html" title="cpp/error"> Diagnostics library</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../utility.html" title="cpp/utility"> General utilities library</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../string.html" title="cpp/string"> Strings library</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../container.html" title="cpp/container"> Containers library</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../iterator.html" title="cpp/iterator"> Iterators library</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../ranges.html" title="cpp/ranges"> Ranges library</a> <span class="t-mark-rev t-since-cxx20">(C++20)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../algorithm.html" title="cpp/algorithm"> Algorithms library</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../numeric.html" title="cpp/numeric"> Numerics library</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../locale.html" title="cpp/locale"> Localizations library</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../io.html" title="cpp/io"> Input/output library</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../filesystem.html" title="cpp/filesystem"> Filesystem library</a> <span class="t-mark-rev t-since-cxx17">(C++17)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../regex.html" title="cpp/regex"> Regular expressions library</a> <span class="t-mark-rev t-since-cxx11">(C++11)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../thread.html" title="cpp/thread"> Concurrency support library</a> <span class="t-mark-rev t-since-cxx11">(C++11)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../experimental.html" title="cpp/experimental"> Technical specifications</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../symbol_index.html" title="cpp/symbol index"> Symbols index</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../links/libs.html" title="cpp/links/libs"> External libraries</a> </td></tr>
</table></div><div></div></div></div></div><div class="t-navbar-sep"> </div><div class="t-navbar-head"><a href="../regex.html" title="cpp/regex"> Regular expressions library</a><div class="t-navbar-menu"><div><div><table class="t-nv-begin" cellpadding="0" style="">
<tr class="t-nv-h1"><td colspan="5"> Classes</td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="basic_regex.html" title="cpp/regex/basic regex"><span class="t-lines"><span>basic_regex</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="sub_match.html" title="cpp/regex/sub match"><span class="t-lines"><span>sub_match</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="match_results.html" title="cpp/regex/match results"><span class="t-lines"><span>match_results</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv-h1"><td colspan="5"> Algorithms</td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="regex_match.html" title="cpp/regex/regex match"><span class="t-lines"><span>regex_match</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="regex_search.html" title="cpp/regex/regex search"><span class="t-lines"><span>regex_search</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="regex_replace.html" title="cpp/regex/regex replace"><span class="t-lines"><span>regex_replace</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv-h1"><td colspan="5"> Iterators</td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="regex_iterator.html" title="cpp/regex/regex iterator"><span class="t-lines"><span>regex_iterator</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="regex_token_iterator.html" title="cpp/regex/regex token iterator"><span class="t-lines"><span>regex_token_iterator</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv-h1"><td colspan="5"> Exceptions</td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="regex_error.html" title="cpp/regex/regex error"><span class="t-lines"><span>regex_error</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv-h1"><td colspan="5"> Traits</td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="regex_traits.html" title="cpp/regex/regex traits"><span class="t-lines"><span>regex_traits</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv-h1"><td colspan="5"> Constants</td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="syntax_option_type.html" title="cpp/regex/syntax option type"><span class="t-lines"><span>syntax_option_type</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="match_flag_type.html" title="cpp/regex/match flag type"><span class="t-lines"><span>match_flag_type</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><strong class="selflink"><span class="t-lines"><span>error_type</span></span></strong></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv-h1"><td colspan="5"> Regex Grammar</td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="ecmascript.html" title="cpp/regex/ecmascript"><span class="t-lines"><span>Modified ECMAScript-262</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
</table></div><div></div></div></div></div><div class="t-navbar-sep"> </div></div>
<table class="t-dcl-begin"><tbody>
<tr class="t-dsc-header">
<td> <div>Defined in header <code><a href="../header/regex.html" title="cpp/header/regex">&lt;regex&gt;</a></code>
 </div></td>
<td></td>
<td></td>
</tr>
<tr class="t-dcl t-since-cxx11">
<td> <div><span class="mw-geshi cpp source-cpp"><span class="kw1">typedef</span> <span class="coMULTI">/*implementation defined*/</span> error_type<span class="sy4">;</span></span></div></td>
<td class="t-dcl-nopad">  </td>
<td> <span class="t-mark-rev t-since-cxx11">(since C++11)</span> </td>
</tr>
</tbody>
<tbody class="t-dcl-rev">
<tr class="t-dcl t-since-cxx11 t-until-cxx17">
<td> <div><span class="mw-geshi cpp source-cpp"><span class="kw4">constexpr</span> error_type error_collate <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<p><span class="kw4">constexpr</span> error_type error_ctype <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw4">constexpr</span> error_type error_escape <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw4">constexpr</span> error_type error_backref <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw4">constexpr</span> error_type error_brack <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw4">constexpr</span> error_type error_paren <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw4">constexpr</span> error_type error_brace <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw4">constexpr</span> error_type error_badbrace <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw4">constexpr</span> error_type error_range <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw4">constexpr</span> error_type error_space <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw4">constexpr</span> error_type error_badrepeat <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw4">constexpr</span> error_type error_complexity <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
</p>
<span class="kw4">constexpr</span> error_type error_stack <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span></span></div></td>
<td class="t-dcl-nopad">  </td>
<td> <span class="t-mark-rev t-since-cxx11">(since C++11)</span> <br><span class="t-mark-rev t-until-cxx17">(until C++17)</span> </td>
</tr>
<tr class="t-dcl t-since-cxx17">
<td> <div><span class="mw-geshi cpp source-cpp"><span class="kw1">inline</span> <span class="kw4">constexpr</span> error_type error_collate <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<p><span class="kw1">inline</span> <span class="kw4">constexpr</span> error_type error_ctype <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw1">inline</span> <span class="kw4">constexpr</span> error_type error_escape <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw1">inline</span> <span class="kw4">constexpr</span> error_type error_backref <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw1">inline</span> <span class="kw4">constexpr</span> error_type error_brack <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw1">inline</span> <span class="kw4">constexpr</span> error_type error_paren <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw1">inline</span> <span class="kw4">constexpr</span> error_type error_brace <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw1">inline</span> <span class="kw4">constexpr</span> error_type error_badbrace <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw1">inline</span> <span class="kw4">constexpr</span> error_type error_range <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw1">inline</span> <span class="kw4">constexpr</span> error_type error_space <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw1">inline</span> <span class="kw4">constexpr</span> error_type error_badrepeat <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
<span class="kw1">inline</span> <span class="kw4">constexpr</span> error_type error_complexity <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span><br>
</p>
<span class="kw1">inline</span> <span class="kw4">constexpr</span> error_type error_stack <span class="sy1">=</span> <span class="coMULTI">/*unspecified*/</span><span class="sy4">;</span></span></div></td>
<td class="t-dcl-nopad">  </td>
<td> <span class="t-mark-rev t-since-cxx17">(since C++17)</span> </td>
</tr>
</tbody><tbody>
<tr class="t-dcl-sep"><td></td><td></td><td></td></tr>
</tbody></table>
<p>The <code>error_type</code> is a type that describes errors that may occur during regular expression parsing.
</p>
<h3><span class="mw-headline" id="Constants">Constants</span></h3>
<table class="t-dsc-begin">

<tr class="t-dsc-hitem">
<td>  Constant
</td>
<td>  Explanation
</td></tr>


<tr class="t-dsc">
<td>  <code>error_collate</code>
</td>
<td>  the expression contains an invalid collating element name
</td></tr>


<tr class="t-dsc">
<td>  <code>error_ctype</code>
</td>
<td>  the expression contains an invalid character class name
</td></tr>


<tr class="t-dsc">
<td>  <code>error_escape</code>
</td>
<td>  the expression contains an invalid escaped character or a trailing escape
</td></tr>


<tr class="t-dsc">
<td>  <code>error_backref</code>
</td>
<td>  the expression contains an invalid back reference
</td></tr>


<tr class="t-dsc">
<td>  <code>error_brack</code>
</td>
<td>  the expression contains mismatched square brackets ('[' and ']')
</td></tr>


<tr class="t-dsc">
<td>  <code>error_paren</code>
</td>
<td>  the expression contains mismatched parentheses ('(' and ')')
</td></tr>


<tr class="t-dsc">
<td>  <code>error_brace</code>
</td>
<td>  the expression contains mismatched curly braces ('{' and '}')
</td></tr>


<tr class="t-dsc">
<td>  <code>error_badbrace</code>
</td>
<td>  the expression contains an invalid range in a {} expression
</td></tr>


<tr class="t-dsc">
<td>  <code>error_range</code>
</td>
<td>  the expression contains an invalid character range (e.g. [b-a])
</td></tr>


<tr class="t-dsc">
<td>  <code>error_space</code>
</td>
<td>  there was not enough memory to convert the expression into a finite state machine
</td></tr>


<tr class="t-dsc">
<td>  <code>error_badrepeat</code>
</td>
<td>  one of *?+{ was not preceded by a valid regular expression
</td></tr>


<tr class="t-dsc">
<td>  <code>error_complexity</code>
</td>
<td>  the complexity of an attempted match exceeded a predefined level
</td></tr>


<tr class="t-dsc">
<td>  <code>error_stack</code>
</td>
<td>  there was not enough memory to perform a match
</td></tr>

</table>
<h3><span class="mw-headline" id="Notes">Notes</span></h3>
<p>In C++11, these constants were specified with redundant keyword <code>static</code>, which was removed by C++14 via <a rel="nofollow" class="external text" href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2053">LWG issue 2053</a>
</p>
<h3><span class="mw-headline" id="Example">Example</span></h3>
<div class="t-example"><p>Implements regular expressions checker.</p><div class="t-example-live-link"><div class="coliru-btn coliru-btn-run-init">Run this code</div></div>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="cpp source-cpp"><pre class="de1"><span class="co2">#include &lt;iomanip&gt;</span>
<span class="co2">#include &lt;iostream&gt;</span>
<span class="co2">#include &lt;regex&gt;</span>
<span class="co2">#include &lt;sstream&gt;</span>
<span class="co2">#include &lt;string&gt;</span>
<span class="kw1">using</span> <span class="kw1">namespace</span> std<span class="sy4">::</span><span class="me2">string_literals</span><span class="sy4">;</span>
 
<span class="kw4">void</span> show_regex_error<span class="br0">(</span><span class="kw4">const</span> <a href="regex_error.html"><span class="kw2029">std::<span class="me2">regex_error</span></span></a><span class="sy3">&amp;</span> e<span class="br0">)</span> <span class="br0">{</span>
    <a href="../string/basic_string.html"><span class="kw1233">std::<span class="me2">string</span></span></a> err_message <span class="sy1">=</span> e.<span class="me1">what</span><span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span>
 
<span class="co2">#   define CASE(type, msg) \
    case std::regex_constants::type: err_message += " ("s + #type "):\n  "s + msg; \
        break</span>
    <span class="kw1">switch</span> <span class="br0">(</span>e.<span class="me1">code</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span>
    CASE<span class="br0">(</span>error_collate, <span class="st0">"The expression contains an invalid collating element name"</span><span class="br0">)</span><span class="sy4">;</span>
    CASE<span class="br0">(</span>error_ctype, <span class="st0">"The expression contains an invalid character class name"</span><span class="br0">)</span><span class="sy4">;</span>
    CASE<span class="br0">(</span>error_escape, <span class="st0">"The expression contains an invalid escaped character or a trailing escape"</span><span class="br0">)</span><span class="sy4">;</span>
    CASE<span class="br0">(</span>error_backref, <span class="st0">"The expression contains an invalid back reference"</span><span class="br0">)</span><span class="sy4">;</span>
    CASE<span class="br0">(</span>error_brack, <span class="st0">"The expression contains mismatched square brackets ('[' and ']')"</span><span class="br0">)</span><span class="sy4">;</span>
    CASE<span class="br0">(</span>error_paren, <span class="st0">"The expression contains mismatched parentheses ('(' and ')')"</span><span class="br0">)</span><span class="sy4">;</span>
    CASE<span class="br0">(</span>error_brace, <span class="st0">"The expression contains mismatched curly braces ('{' and '}')"</span><span class="br0">)</span><span class="sy4">;</span>
    CASE<span class="br0">(</span>error_badbrace, <span class="st0">"The expression contains an invalid range in a {} expression"</span><span class="br0">)</span><span class="sy4">;</span>
    CASE<span class="br0">(</span>error_range, <span class="st0">"The expression contains an invalid character range (e.g. [b-a])"</span><span class="br0">)</span><span class="sy4">;</span>
    CASE<span class="br0">(</span>error_space, <span class="st0">"There was not enough memory to convert the expression into a finite state machine"</span><span class="br0">)</span><span class="sy4">;</span>
    CASE<span class="br0">(</span>error_badrepeat, <span class="st0">"one of *?+{ was not preceded by a valid regular expression"</span><span class="br0">)</span><span class="sy4">;</span>
    CASE<span class="br0">(</span>error_complexity, <span class="st0">"The complexity of an attempted match exceeded a predefined level"</span><span class="br0">)</span><span class="sy4">;</span>
    CASE<span class="br0">(</span>error_stack, <span class="st0">"There was not enough memory to perform a match"</span><span class="br0">)</span><span class="sy4">;</span>
    <span class="br0">}</span>
<span class="co2">#   undef CASE</span>
 
    <span class="coMULTI">/* std::cerr */</span> <a href="../io/cout.html"><span class="kw1762">std::<span class="me2">cout</span></span></a> <span class="sy1">&lt;&lt;</span> err_message <span class="sy1">&lt;&lt;</span> <span class="st0">". <span class="es1">\n</span><span class="es1">\n</span>"</span><span class="sy4">;</span>
<span class="br0">}</span>
 
<span class="kw4">void</span> regular_expression_checker<span class="br0">(</span><span class="kw4">const</span> <a href="../string/basic_string.html"><span class="kw1233">std::<span class="me2">string</span></span></a><span class="sy3">&amp;</span> text,
                                <span class="kw4">const</span> <a href="../string/basic_string.html"><span class="kw1233">std::<span class="me2">string</span></span></a><span class="sy3">&amp;</span> regex,
                                <span class="kw4">const</span> std<span class="sy4">::</span><span class="me2">regex</span><span class="sy4">::</span><span class="me2">flag_type</span> flags<span class="br0">)</span> <span class="br0">{</span>
    <a href="../io/cout.html"><span class="kw1762">std::<span class="me2">cout</span></span></a> <span class="sy1">&lt;&lt;</span> <span class="st0">"Text: "</span> <span class="sy1">&lt;&lt;</span> quoted<span class="br0">(</span>text<span class="br0">)</span> <span class="sy1">&lt;&lt;</span> <span class="st0">"<span class="es1">\n</span>Regex: "</span> <span class="sy1">&lt;&lt;</span> quoted<span class="br0">(</span>regex<span class="br0">)</span> <span class="sy1">&lt;&lt;</span> <span class="st0">'<span class="es1">\n</span>'</span><span class="sy4">;</span>
    <span class="kw1">try</span> <span class="br0">{</span>
        <span class="kw4">const</span> <a href="basic_regex.html"><span class="kw2004">std::<span class="me2">regex</span></span></a> re<span class="br0">{</span>regex, flags<span class="br0">}</span><span class="sy4">;</span>
        <span class="kw4">const</span> <span class="kw4">bool</span> matched <span class="sy1">=</span> <a href="regex_match.html"><span class="kw2016">std::<span class="me2">regex_match</span></span></a><span class="br0">(</span>text, re<span class="br0">)</span><span class="sy4">;</span>
 
        <a href="../io/basic_stringstream.html"><span class="kw1741">std::<span class="me2">stringstream</span></span></a> out<span class="sy4">;</span>
        out <span class="sy1">&lt;&lt;</span> <span class="br0">(</span>matched <span class="sy4">?</span> <span class="st0">"MATCH!<span class="es1">\n</span>"</span> <span class="sy4">:</span> <span class="st0">"DOES NOT MATCH!<span class="es1">\n</span>"</span><span class="br0">)</span><span class="sy4">;</span>
 
        <a href="match_results.html"><span class="kw2014">std::<span class="me2">smatch</span></span></a> m<span class="sy4">;</span>
        <span class="kw1">if</span> <span class="br0">(</span><a href="regex_search.html"><span class="kw2017">std::<span class="me2">regex_search</span></span></a><span class="br0">(</span>text, m, re<span class="br0">)</span><span class="sy4">;</span> <span class="sy3">!</span>m.<span class="me1">empty</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span>
            out <span class="sy1">&lt;&lt;</span> <span class="st0">"prefix = ["</span> <span class="sy1">&lt;&lt;</span> m.<span class="me1">prefix</span><span class="br0">(</span><span class="br0">)</span>.<span class="me1">str</span><span class="br0">(</span><span class="br0">)</span>.<span class="me1">data</span><span class="br0">(</span><span class="br0">)</span> <span class="sy1">&lt;&lt;</span> <span class="st0">"]<span class="es1">\n</span>"</span><span class="sy4">;</span>
 
            <span class="kw1">for</span> <span class="br0">(</span><a href="../types/size_t.html"><span class="kw106">std::<span class="me2">size_t</span></span></a> i<span class="br0">{</span><span class="br0">}</span><span class="sy4">;</span> i <span class="sy3">!</span><span class="sy1">=</span> m.<span class="me1">size</span><span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span> <span class="sy2">++</span>i<span class="br0">)</span>
                out <span class="sy1">&lt;&lt;</span> <span class="st0">"  m["</span> <span class="sy1">&lt;&lt;</span> i <span class="sy1">&lt;&lt;</span> <span class="st0">"] = ["</span> <span class="sy1">&lt;&lt;</span> m<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">str</span><span class="br0">(</span><span class="br0">)</span>.<span class="me1">data</span><span class="br0">(</span><span class="br0">)</span> <span class="sy1">&lt;&lt;</span> <span class="st0">"]<span class="es1">\n</span>"</span><span class="sy4">;</span>
 
            out <span class="sy1">&lt;&lt;</span> <span class="st0">"suffix = ["</span> <span class="sy1">&lt;&lt;</span> m.<span class="me1">suffix</span><span class="br0">(</span><span class="br0">)</span>.<span class="me1">str</span><span class="br0">(</span><span class="br0">)</span>.<span class="me1">data</span><span class="br0">(</span><span class="br0">)</span> <span class="sy1">&lt;&lt;</span> <span class="st0">"]<span class="es1">\n</span>"</span><span class="sy4">;</span>
        <span class="br0">}</span>
        <a href="../io/cout.html"><span class="kw1762">std::<span class="me2">cout</span></span></a> <span class="sy1">&lt;&lt;</span> out.<span class="me1">str</span><span class="br0">(</span><span class="br0">)</span> <span class="sy1">&lt;&lt;</span> <span class="st0">'<span class="es1">\n</span>'</span><span class="sy4">;</span>
    <span class="br0">}</span> <span class="kw1">catch</span> <span class="br0">(</span><a href="regex_error.html"><span class="kw2029">std::<span class="me2">regex_error</span></span></a><span class="sy3">&amp;</span> ex<span class="br0">)</span> <span class="br0">{</span>
        show_regex_error<span class="br0">(</span>ex<span class="br0">)</span><span class="sy4">;</span>
    <span class="br0">}</span>
<span class="br0">}</span>
 
<span class="kw4">int</span> main<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span>
 
    <span class="kw4">constexpr</span> std<span class="sy4">::</span><span class="me2">regex</span><span class="sy4">::</span><span class="me2">flag_type</span> your_flags
        <span class="sy1">=</span> std<span class="sy4">::</span><span class="me2">regex</span><span class="sy4">::</span><span class="me2">flag_type</span><span class="br0">{</span><span class="nu0">0</span><span class="br0">}</span>
    <span class="co1">// Choose one of the supported grammars:</span>
        <span class="sy3">|</span> std<span class="sy4">::</span><span class="me2">regex</span><span class="sy4">::</span><span class="me2">ECMAScript</span>
    <span class="co1">//  | std::regex::basic</span>
    <span class="co1">//  | std::regex::extended</span>
    <span class="co1">//  | std::regex::awk</span>
    <span class="co1">//  | std::regex::grep</span>
    <span class="co1">//  | std::regex::egrep</span>
    <span class="co1">// Choose any of the next options:</span>
    <span class="co1">//  | std::regex::icase</span>
    <span class="co1">//  | std::regex::nosubs</span>
    <span class="co1">//  | std::regex::optimize</span>
    <span class="co1">//  | std::regex::collate</span>
    <span class="co1">//  | std::regex::multiline</span>
        <span class="sy4">;</span>
 
    <span class="kw4">const</span> <span class="kw4">auto</span> your_text <span class="sy1">=</span> <span class="st0">"Hello regular expressions."</span>s<span class="sy4">;</span>
    <span class="kw4">const</span> <span class="kw4">auto</span> your_regex <span class="sy1">=</span> R<span class="st0">"(([a-zA-Z]+) ([a-z]+) ([a-z]+)\.)"</span>s<span class="sy4">;</span>
    regular_expression_checker<span class="br0">(</span>your_text, your_regex, your_flags<span class="br0">)</span><span class="sy4">;</span>
 
    regular_expression_checker<span class="br0">(</span><span class="st0">"Invalid!"</span>, R<span class="st0">"(((.)(.))"</span>, your_flags<span class="br0">)</span><span class="sy4">;</span>
    regular_expression_checker<span class="br0">(</span><span class="st0">"Invalid!"</span>, R<span class="st0">"([.)"</span>, your_flags<span class="br0">)</span><span class="sy4">;</span>
    regular_expression_checker<span class="br0">(</span><span class="st0">"Invalid!"</span>, R<span class="st0">"([.]{})"</span>, your_flags<span class="br0">)</span><span class="sy4">;</span>
    regular_expression_checker<span class="br0">(</span><span class="st0">"Invalid!"</span>, R<span class="st0">"([1-0])"</span>, your_flags<span class="br0">)</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div></div>
<p>Possible output:
</p>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="text source-text"><pre class="de1">Text: "Hello regular expressions."
Regex: "([a-zA-Z]+) ([a-z]+) ([a-z]+)\\."
MATCH!
prefix = []
  m[0] = [Hello regular expressions.]
  m[1] = [Hello]
  m[2] = [regular]
  m[3] = [expressions]
suffix = []
 
Text: "Invalid!"
Regex: "((.)(.)"
Parenthesis is not closed. (error_paren):
  The expression contains mismatched parentheses ('(' and ')').
 
Text: "Invalid!"
Regex: "[."
Unexpected character in bracket expression. (error_brack):
  The expression contains mismatched square brackets ('[' and ']').
 
Text: "Invalid!"
Regex: "[.]{}"
Unexpected token in brace expression. (error_badbrace):
  The expression contains an invalid range in a {} expression.
 
Text: "Invalid!"
Regex: "[1-0]"
Invalid range in bracket expression. (error_range):
  The expression contains an invalid character range (e.g. [b-a]).</pre></div></div> 
</div>
<h3><span class="mw-headline" id="See_also">See also</span></h3>
<table class="t-dsc-begin">

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="regex_error.html" title="cpp/regex/regex error"> <span class="t-lines"><span>regex_error</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   reports errors generated by the regular expressions library  <br> <span class="t-mark">(class)</span> </td></tr>
</table>

<!-- 
NewPP limit report
Preprocessor visited node count: 2701/1000000
Preprocessor generated node count: 8664/1000000
Post‐expand include size: 73141/2097152 bytes
Template argument size: 32186/2097152 bytes
Highest expansion depth: 20/40
Expensive parser function count: 0/100
-->

<!-- Saved in parser cache with key mwiki1-mwiki_en_:pcache:idhash:2322-0!*!0!!en!*!* and timestamp 20220410152536 -->
</div>                    <!-- /bodycontent -->
                                        <!-- printfooter -->
                    <div class="printfooter">
                    Retrieved from "<a href="https://en.cppreference.com/mwiki/index.php?title=cpp/regex/error_type&amp;oldid=137060">https://en.cppreference.com/mwiki/index.php?title=cpp/regex/error_type&amp;oldid=137060</a>"                    </div>
                    <!-- /printfooter -->
                                                            <!-- catlinks -->
                    <!-- /catlinks -->
                                                            <div class="visualClear"></div>
                    <!-- debughtml -->
                                        <!-- /debughtml -->
                </div>
                <!-- /bodyContent -->
            </div>
        </div>
        <!-- /content -->
        <!-- footer -->
        <div id="cpp-footer-base" class="noprint">
            <div id="footer">
                        <div id="cpp-navigation">
            <h5>Navigation</h5>
            <ul><li><a href="https://en.cppreference.com/w/cpp/regex/error_type">Online version</a></li><li>Offline version retrieved 2022-07-30 14:05.</li></ul></div>
                        <ul id="footer-info">
                                    <li id="footer-info-lastmod"> This page was last modified on 10 January 2022, at 17:48.</li>
                                    <li id="footer-info-viewcount">This page has been accessed 34,326 times.</li>
                            </ul>
                    </div>
        </div>
        <!-- /footer -->
        <script>if(window.mw){
mw.loader.state({"site":"loading","user":"missing","user.groups":"ready"});
}</script>
<script src="../../../common/skin_scripts.js"></script>
<script>if(window.mw){
mw.loader.load(["mediawiki.action.view.postEdit","mediawiki.user","mediawiki.page.ready","mediawiki.searchSuggest","mediawiki.hidpi","ext.gadget.ColiruCompiler","ext.gadget.MathJax"], null, true);
}</script>
<script src="../../../common/site_scripts.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2828341-1']);
_gaq.push(['_setDomainName', 'cppreference.com']);
_gaq.push(['_trackPageview']);
</script><!-- Served in 1.535 secs. -->
	</body>
<!-- Cached 20220410152536 -->
</html>